package trabalho3.view;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;

import javax.swing.DefaultComboBoxModel;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.border.BevelBorder;
import javax.swing.border.LineBorder;

public class Configuracoes extends JDialog {
	
	private static final long serialVersionUID = 1007319107788465546L;
	private final JPanel contentPanel = new JPanel();
	
	private JComboBox<String> comboBoxFiguras;
	private JComboBox<String> comboBoxCoordenadas;
	private JCheckBox checkBoxAtivarBoundingBox;
	private JCheckBox checkBoxAtivarTextura;
	
	private JPanel panelPreview;
	
	private JButton okButtonConfiguracoes;
	
//	public static void main(String[] args) {
//		try {
//			Configuracoes dialog = new Configuracoes();
//			dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
//			dialog.setVisible(true);
//		} catch (Exception e) {
//			e.printStackTrace();
//		}
//	}

	/**
	 * Create the dialog.
	 */
	public Configuracoes() {
		setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
		setTitle("Configura\u00E7\u00F5es");
		setBounds(100, 100, 450, 300);
		getContentPane().setLayout(new BorderLayout());
		contentPanel.setBorder(new LineBorder(new Color(0, 0, 0)));
		getContentPane().add(contentPanel, BorderLayout.CENTER);
		contentPanel.setLayout(new BorderLayout(0, 0));
		{
			JPanel panel = new JPanel();
			contentPanel.add(panel, BorderLayout.CENTER);
			{
				comboBoxFiguras = new JComboBox<String>();
				comboBoxFiguras.setModel(new DefaultComboBoxModel<String>(new String[] {"Figura 1", "Figura 2"}));
				comboBoxFiguras.setSelectedIndex(0);
			}
			{
				panelPreview = new JPanel();
				panelPreview.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
			}
			GroupLayout gl_panel = new GroupLayout(panel);
			gl_panel.setHorizontalGroup(
				gl_panel.createParallelGroup(Alignment.LEADING)
					.addGroup(gl_panel.createSequentialGroup()
						.addGap(5)
						.addComponent(comboBoxFiguras, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
						.addGap(5)
						.addComponent(panelPreview, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE)
						.addGap(270))
			);
			gl_panel.setVerticalGroup(
				gl_panel.createParallelGroup(Alignment.LEADING)
					.addGroup(gl_panel.createSequentialGroup()
						.addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
							.addGroup(gl_panel.createSequentialGroup()
								.addGap(5)
								.addComponent(comboBoxFiguras, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
							.addGroup(gl_panel.createSequentialGroup()
								.addGap(10)
								.addComponent(panelPreview, GroupLayout.PREFERRED_SIZE, 76, GroupLayout.PREFERRED_SIZE)))
						.addContainerGap(70, Short.MAX_VALUE))
			);
			panel.setLayout(gl_panel);
		}
		{
			JPanel panel = new JPanel();
			FlowLayout flowLayout = (FlowLayout) panel.getLayout();
			flowLayout.setAlignment(FlowLayout.LEFT);
			contentPanel.add(panel, BorderLayout.NORTH);
			{
				checkBoxAtivarTextura = new JCheckBox("Ativar Textura");
				panel.add(checkBoxAtivarTextura);
			}
			{
				checkBoxAtivarBoundingBox = new JCheckBox("Ativar Bounding Box");
				panel.add(checkBoxAtivarBoundingBox);
			}
		}
		{
			JPanel panel = new JPanel();
			FlowLayout flowLayout = (FlowLayout) panel.getLayout();
			flowLayout.setAlignment(FlowLayout.LEFT);
			contentPanel.add(panel, BorderLayout.SOUTH);
			{
				comboBoxCoordenadas = new JComboBox<String>();
				panel.add(comboBoxCoordenadas);
				comboBoxCoordenadas.setModel(new DefaultComboBoxModel<String>(new String[] {"Coordenadas Esf\u00E9ricas"}));
				comboBoxCoordenadas.setSelectedIndex(0);
			}
		}
		{
			JPanel buttonPane = new JPanel();
			buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
			getContentPane().add(buttonPane, BorderLayout.SOUTH);
			{
				okButtonConfiguracoes = new JButton("OK");
				okButtonConfiguracoes.setActionCommand("OK");
				buttonPane.add(okButtonConfiguracoes);
				getRootPane().setDefaultButton(okButtonConfiguracoes);
			}
//			{
//				JButton cancelButton = new JButton("Cancel");
//				cancelButton.setActionCommand("Cancel");
//				buttonPane.add(cancelButton);
//			}
		}
	}
	
	
	//GETTERS E SETTERS
	public JPanel getPanelPreview() {
		return panelPreview;
	}
	
	public void setPanelPreview(JPanel panelPreview) {
		this.panelPreview = panelPreview;
	}
	
	public JCheckBox getCheckBoxAtivarBoundingBox() {
		return checkBoxAtivarBoundingBox;
	}
	
	public JCheckBox getCheckBoxAtivarTextura() {
		return checkBoxAtivarTextura;
	}
	
	public JComboBox<String> getComboBoxFiguras() {
		return comboBoxFiguras;
	}
	
	public JComboBox<String> getComboBoxCoordenadas() {
		return comboBoxCoordenadas;
	}
	
	public JButton getOkButtonConfiguracoes() {
		return okButtonConfiguracoes;
	}

}
